package ar.maikoova.GUIControllers;

import java.sql.ResultSet;
import java.sql.SQLException;

import javax.swing.table.DefaultTableModel;

import ar.maikoova.GUI.ClienteInversorGUI;
import ar.maikoova.models.ClienteInversor;
import ar.maikoova.modelsControllers.ClienteInversorController;

public class ClienteInversorGUIController {
	
	ClienteInversorGUI clienteInversorGUI;
	
	public void init(ClienteInversorGUI clienteInversorGUI){
		setClienteInversorGUI(clienteInversorGUI);
	}
	
	public ClienteInversor getClienteInversor(){
		ClienteInversor clienteInversor = new ClienteInversor();
		clienteInversor.setNumeroCliente(clienteInversorGUI.getNumeroCliente());
		clienteInversor.setNombreCliente(clienteInversorGUI.getNombre());
		clienteInversor.setApellidoCliente(clienteInversorGUI.getApellido());
		clienteInversor.setDomicilioCliente(clienteInversorGUI.getDomicilio());
		clienteInversor.setDniCliente(clienteInversorGUI.getDocumento());
		clienteInversor.setCuilCliente(clienteInversorGUI.getCuil());
		clienteInversor.setNacimientoCliente(clienteInversorGUI.getNacimiento());
		clienteInversor.setTelContactoCliente(clienteInversorGUI.getTelefono());
		System.out.println("exito");
		System.out.println(clienteInversor);
		return clienteInversor;
	}

	public ClienteInversorGUI getClienteInversorGUI() {
		return clienteInversorGUI;
	}

	public void setClienteInversorGUI(ClienteInversorGUI clienteInversorGUI) {
		this.clienteInversorGUI = clienteInversorGUI;
	}

	public DefaultTableModel todosLosClientes() {
		ClienteInversorController cController = new ClienteInversorController();
		try {
			return cController.todosLosClientes();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
